bl_info = {
    "name": "L_Link",
    "author": "linchun",
    "version": (1, 0),
    "blender": (4, 0, 0),  # 兼容的 Blender 版本
    "location": "View3D",
    "description": "一个maya无缝互传模型的插件,maya仅支持2020+,由于maya不支持英文命名模型名请避免中文命名",
    "warning": "",
    "doc_url": "",
    "category": "3D View",
}



import bpy
from bpy.types import Menu, Operator
from . import core




class OBJECT_OT_send_maya_Action(Operator):
    bl_idname = "object.send_to_maya"
    bl_label = "Send to Maya"
    bl_description = "Export selected meshes as OBJ for Maya"

    def execute(self, context):
        return(core.send_to_maya())

        

class VIEW3D_MT_CustomRightClickMenu(Menu):
    bl_label = "Send To >>"
    bl_idname = "VIEW3D_MT_custom_menu"

    def draw(self, context):
        layout = self.layout
        layout.operator("object.send_to_maya", text="Maya")

def register():
    core.start_file_listener()
    bpy.utils.register_class(OBJECT_OT_send_maya_Action)
    bpy.utils.register_class(VIEW3D_MT_CustomRightClickMenu)
    bpy.types.VIEW3D_MT_object_context_menu.append(
        lambda self, context: self.layout.menu(VIEW3D_MT_CustomRightClickMenu.bl_idname)
    )

def unregister():
    bpy.utils.unregister_class(OBJECT_OT_send_maya_Action)
    bpy.utils.unregister_class(VIEW3D_MT_CustomRightClickMenu)
    bpy.types.VIEW3D_MT_object_context_menu.remove(
        lambda self, context: self.layout.menu(VIEW3D_MT_CustomRightClickMenu.bl_idname)
    )

if __name__ == "__main__":
    register()